cmake_minimum_required(VERSION 3.10)

project(SQLite3)

# 设置编译选项（启用扩展功能）
set(SQLITE_OPTIONS
    -DSQLITE_ENABLE_FTS3
    -DSQLITE_ENABLE_FTS4
    -DSQLITE_ENABLE_FTS5
    -DSQLITE_ENABLE_JSON1
    -DSQLITE_ENABLE_RTREE
    -DSQLITE_THREADSAFE=1
)

# 强制导出所有符号
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)  

# 指定生成的目标路径
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG  	"${CMAKE_BINARY_DIR}/../bin/Debug")		   
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE  "${CMAKE_BINARY_DIR}/../bin/Release")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG  	"${CMAKE_BINARY_DIR}/../bin/Debug")		
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE  "${CMAKE_BINARY_DIR}/../bin/Release")

# 生成动态库（SHARED）
add_library(sqlite3 SHARED sqlite3.c)
#add_library(sqlite3 STATIC sqlite3.c)	#静态库
target_compile_options(sqlite3 PRIVATE ${SQLITE_OPTIONS})
target_include_directories(sqlite3 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

#编译的命令
# cmake -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release/Debug
# cmake --build build